/*
 * Copyright (c) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef SOFTBUS_ERROR_CODE_H
#define SOFTBUS_ERROR_CODE_H

#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif

enum SoftBusErrNo {
    SOFTBUS_PUBLIC_ERR_BASE = (-13000),

    SOFTBUS_FRAMEWORK_ERR_BASE = (-12000),
    SOFTBUS_INVALID_PKGNAME,
    SOFTBUS_FUNC_NOT_SUPPORT,
    SOFTBUS_SERVER_NOT_INIT,

    SOFTBUS_TRANS_ERR_BASE = (-11000),

    SOFTBUS_TRANS_INVALID_SESSION_ID,
    SOFTBUS_TRANS_INVALID_SESSION_NAME,
    SOFTBUS_TRANS_INVALID_CHANNEL_TYPE,
    SOFTBUS_TRANS_INVALID_CLOSE_CHANNEL_ID,
    SOFTBUS_TRANS_SESSION_REPEATED,
    SOFTBUS_TRANS_SESSION_CNT_EXCEEDS_LIMIT,
    SOFTBUS_TRANS_SESSIONSERVER_NOT_CREATED,
    SOFTBUS_TRANS_SESSION_OPENING,
    SOFTBUS_TRANS_GET_LANE_INFO_ERR,
    SOFTBUS_TRANS_INVALID_DATA_LENGTH,
    SOFTBUS_TRANS_FUNC_NOT_SUPPORT,
    SOFTBUS_TRANS_OPEN_AUTH_CHANNANEL_FAILED,
    SOFTBUS_TRANS_GET_P2P_INFO_FAILED,
    SOFTBUS_TRANS_OPEN_AUTH_CONN_FAILED,

    SOFTBUS_TRANS_PROXY_PACKMSG_ERR,
    SOFTBUS_TRANS_PROXY_SENDMSG_ERR,
    SOFTBUS_TRANS_PROXY_SEND_CHANNELID_INVALID,
    SOFTBUS_TRANS_PROXY_CHANNLE_STATUS_INVALID,
    SOFTBUS_TRANS_PROXY_DEL_CHANNELID_INVALID,
    SOFTBUS_TRANS_PROXY_SESS_ENCRYPT_ERR,
    SOFTBUS_TRANS_PROXY_INVALID_SLICE_HEAD,
    SOFTBUS_TRANS_PROXY_ASSEMBLE_PACK_NO_INVALID,
    SOFTBUS_TRANS_PROXY_ASSEMBLE_PACK_EXCEED_LENGTH,
    SOFTBUS_TRANS_PROXY_ASSEMBLE_PACK_DATA_NULL,

    SOFTBUS_TRANS_UDP_CLOSE_CHANNELID_INVALID,
    SOFTBUS_TRANS_UDP_SERVER_ADD_CHANNEL_FAILED,
    SOFTBUS_TRANS_UDP_CLIENT_ADD_CHANNEL_FAILED,
    SOFTBUS_TRANS_UDP_SERVER_NOTIFY_APP_OPEN_FAILED,
    SOFTBUS_TRANS_UDP_CLIENT_NOTIFY_APP_OPEN_FAILED,
    SOFTBUS_TRANS_UDP_START_STREAM_SERVER_FAILED,
    SOFTBUS_TRANS_UDP_START_STREAM_CLIENT_FAILED,
    SOFTBUS_TRANS_UDP_SEND_STREAM_FAILED,

    SOFTBUS_TRANS_QOS_REPORT_FAILED,
    SOFTBUS_TRANS_QOS_REPORT_TOO_FREQUENT,

    SOFTBUS_AUTH_ERR_BASE = (-9000),
    SOFTBUS_AUTH_VERIFIED,
    SOFTBUS_AUTH_VERIFYING,
    SOFTBUS_AUTH_SYNC_DEVID_FAILED,
    SOFTBUS_AUTH_UNPACK_DEVID_FAILED,
    SOFTBUS_AUTH_HICHAIN_PROCESS_FAILED,
    SOFTBUS_AUTH_HICHAIN_AUTH_DEVICE_FAILED,
    SOFTBUS_AUTH_HICHAIN_AUTH_ERROR,
    SOFTBUS_AUTH_TIMEOUT,
    SOFTBUS_AUTH_EXISTED,
    SOFTBUS_AUTH_NOT_EXISTED,

    SOFTBUS_NETWORK_ERR_BASE = (-7000),
    SOFTBUS_NETWORK_CONN_FSM_DEAD,
    SOFTBUS_NETWORK_JOIN_CANCELED,
    SOFTBUS_NETWORK_JOIN_LEAVING,
    SOFTBUS_NETWORK_JOIN_TIMEOUT,
    SOFTBUS_NETWORK_UNPACK_DEV_INFO_FAILED,
    SOFTBUS_NETWORK_DEV_NOT_TRUST,
    SOFTBUS_NETWORK_LEAVE_OFFLINE,
    SOFTBUS_NETWORK_AUTH_DISCONNECT,
    SOFTBUS_NETWORK_TIME_SYNC_HANDSHAKE_ERR, // time sync channel pipe broken
    SOFTBUS_NETWORK_TIME_SYNC_HANDSHAKE_TIMEOUT, // timeout during handshake
    SOFTBUS_NETWORK_TIME_SYNC_TIMEOUT, // timeout during sync
    SOFTBUS_NETWORK_TIME_SYNC_INTERFERENCE, // interference
    SOFTBUS_NETWORK_HEARTBEAT_REPEATED,
    SOFTBUS_NETWORK_HEARTBEAT_UNTRUSTED,
    SOFTBUS_NETWORK_NODE_OFFLINE,

    SOFTBUS_CONN_ERR_BASE = (-5000),
    SOFTBUS_CONN_FAIL,
    SOFTBUS_CONN_MANAGER_TYPE_NOT_SUPPORT,
    SOFTBUS_CONN_MANAGER_OP_NOT_SUPPORT,
    SOFTBUS_CONN_MANAGER_PKT_LEN_INVALID,
    SOFTBUS_CONN_MANAGER_LIST_NOT_INIT,
    SOFTBUS_CONN_INVALID_CONN_TYPE,
    SOFTBUS_CONNECTION_BASE,
    SOFTBUS_CONNECTION_ERR_CLOSED,
    SOFTBUS_CONNECTION_ERR_DRIVER_CONGEST,
    SOFTBUS_CONNECTION_ERR_SOFTBUS_CONGEST,
    SOFTBUS_CONNECTION_ERR_CONNID_INVALID,
    SOFTBUS_CONNECTION_ERR_SENDQUEUE_FULL,
    SOFTBUS_BRCONNECTION_POSTBYTES_ERROR,
    SOFTBUS_BRCONNECTION_GETCONNINFO_ERROR,
    SOFTBUS_BRCONNECTION_STRNCPY_ERROR,
    SOFTBUS_BRCONNECTION_PACKJSON_ERROR,
    SOFTBUS_BRCONNECTION_CONNECTDEVICE_MALLOCFAIL,
    SOFTBUS_BRCONNECTION_CONNECTDEVICE_GETSOCKETIDFAIL,
    SOFTBUS_BRCONNECTION_DISCONNECT_NOTFIND,
    SOFTBUS_TCPCONNECTION_SOCKET_ERR,
    SOFTBUS_BLECONNECTION_REG_GATTS_CALLBACK_FAIL,
    SOFTBUS_BLECONNECTION_ADD_SERVICE_FAIL,
    SOFTBUS_BLECONNECTION_ADD_CHAR_FAIL,
    SOFTBUS_BLECONNECTION_ADD_DES_FAIL,
    SOFTBUS_BLECONNECTION_NOT_INIT,
    SOFTBUS_BLECONNECTION_NOT_START,
    SOFTBUS_BLECONNECTION_GETCONNINFO_ERROR,
    SOFTBUS_BLECONNECTION_MTU_OVERFLOW_ERROR,
    SOFTBUS_BLECONNECTION_MUTEX_LOCK_ERROR,
    SOFTBUS_BLECONNECTION_GATT_CLIENT_NOT_SUPPORT,
    SOFTBUS_GATTC_INTERFACE_FAILED,
    SOFTBUS_BLEGATTC_NONT_INIT,
    SOFTBUS_BLEGATTC_NOT_READY,
    SOFTBUS_GATTC_DUPLICATE_PARAM,
    SOFTBUS_GATTC_NONE_PARAM,
    SOFTBUS_BLEGATTC_NODE_NOT_EXIST,

    SOFTBUS_DISCOVER_ERR_BASE = (-3000),

    SOFTBUS_DISCOVER_NOT_INIT,
    SOFTBUS_DISCOVER_INVALID_PKGNAME,
    SOFTBUS_DISCOVER_SERVER_NO_PERMISSION,
    SOFTBUS_DISCOVER_MANAGER_NOT_INIT,
    SOFTBUS_DISCOVER_MANAGER_ITEM_NOT_CREATE,
    SOFTBUS_DISCOVER_MANAGER_INFO_NOT_CREATE,
    SOFTBUS_DISCOVER_MANAGER_INFO_NOT_DELETE,
    SOFTBUS_DISCOVER_MANAGER_INNERFUNCTION_FAIL,
    SOFTBUS_DISCOVER_MANAGER_CAPABILITY_INVALID,
    SOFTBUS_DISCOVER_MANAGER_DUPLICATE_PARAM,
    SOFTBUS_DISCOVER_MANAGER_INVALID_PARAM,
    SOFTBUS_DISCOVER_MANAGER_INVALID_MEDIUM,
    SOFTBUS_DISCOVER_MANAGER_INVALID_PKGNAME,
    SOFTBUS_DISCOVER_MANAGER_INVALID_MODULE,
    SOFTBUS_DISCOVER_COAP_NOT_INIT,
    SOFTBUS_DISCOVER_COAP_INIT_FAIL,
    SOFTBUS_DISCOVER_COAP_MERGE_CAP_FAIL,
    SOFTBUS_DISCOVER_COAP_CANCEL_CAP_FAIL,
    SOFTBUS_DISCOVER_COAP_REGISTER_CAP_FAIL,
    SOFTBUS_DISCOVER_COAP_SET_FILTER_CAP_FAIL,
    SOFTBUS_DISCOVER_COAP_REGISTER_DEVICE_FAIL,
    SOFTBUS_DISCOVER_COAP_START_PUBLISH_FAIL,
    SOFTBUS_DISCOVER_COAP_STOP_PUBLISH_FAIL,
    SOFTBUS_DISCOVER_COAP_START_DISCOVER_FAIL,
    SOFTBUS_DISCOVER_COAP_STOP_DISCOVER_FAIL,

    SOFTBUS_COMMOM_ERR_BASE = (-1000),
    SOFTBUS_TIMOUT,
    SOFTBUS_INVALID_PARAM,
    SOFTBUS_MEM_ERR,
    SOFTBUS_NOT_IMPLEMENT,
    SOFTBUS_NO_URI_QUERY_KEY,
    SOFTBUS_NO_INIT,
    SOFTBUS_PARSE_JSON_ERR,
    SOFTBUS_PERMISSION_DENIED,
    SOFTBUS_MALLOC_ERR,
    SOFTBUS_ENCRYPT_ERR,
    SOFTBUS_DECRYPT_ERR,
    SOFTBUS_INVALID_SESS_OPCODE,
    SOFTBUS_INVALID_NUM,
    SOFTBUS_SERVER_NAME_REPEATED,
    SOFTBUS_TCP_SOCKET_ERR,
    SOFTBUS_LOCK_ERR,
    SOFTBUS_GET_REMOTE_UUID_ERR,
    SOFTBUS_NO_ENOUGH_DATA,
    SOFTBUS_INVALID_DATA_HEAD,
    SOFTBUS_INVALID_FD,
    SOFTBUS_FILE_ERR,
    SOFTBUS_DATA_NOT_ENOUGH,
    SOFTBUS_SLICE_ERROR,
    SOFTBUS_ALREADY_EXISTED,
    SOFTBUS_GET_CONFIG_VAL_ERR,
    SOFTBUS_PEER_PROC_ERR,
    SOFTBUS_NOT_FIND,

    SOFTBUS_ERR = (-1),
    SOFTBUS_OK = 0,
};

#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* SOFTBUS_ERRCODE_H */
